home *** CD-ROM | disk | FTP | other *** search
/ Amiga Format CD 7 / Amiga Format AFCD07 (Dec 1996, Issue 91).iso / serious / shareware / programming / aros / makefile < prev    next >
Makefile  |  1996-09-13  |  4KB  |  154 lines

  1. TOP=.
  2. CURDIR=.
  3.  
  4. SPECIAL_CFLAGS = -Dmain=submain
  5.  
  6. include $(TOP)/make.cfg
  7.  
  8. DEP_LIBS= $(LIBDIR)/libAmigaOS.a \
  9.     $(GENDIR)/filesys/emul_handler.o \
  10.     $(LIBDIR)/libaros.a
  11.  
  12. LIBS=-L$(LIBDIR) \
  13.     $(GENDIR)/filesys/emul_handler.o -lAmigaOS -laros
  14.  
  15. SUBDIRS = $(KERNEL) aros exec dos utility graphics intuition \
  16.     alib filesys libs devs c
  17. DIST_FILES = makefile arosshell.c README* make.cfg crypt.c \
  18.     configure scripts/cint2.awk scripts/makefunctable.awk \
  19.     scripts/genprotos.h AFD-COPYRIGHT BUGS
  20.  
  21. TESTDIR = $(BINDIR)/test
  22. TESTS = $(TESTDIR)/tasktest \
  23.     $(TESTDIR)/signaltest \
  24.     $(TESTDIR)/exceptiontest \
  25.     $(TESTDIR)/tasktest2 \
  26.     $(TESTDIR)/messagetest \
  27.     $(TESTDIR)/semaphoretest \
  28.     $(TESTDIR)/initstructtest \
  29.     $(TESTDIR)/devicetest \
  30.     $(TESTDIR)/filetest
  31.  
  32. all : setup subdirs AmigaOS \
  33.         $(BINDIR)/s/Startup-Sequence $(BINDIR)/arosshell
  34.  
  35. crypt : crypt.c
  36.     $(CC) -o crypt crypt.c
  37.  
  38. dist : dist-dir dist-tar dist-lha
  39.     cp README dist/AROSbin-$(VERSION).readme
  40.     cp README dist/AROSdev-$(VERSION).readme
  41.  
  42. dist-dir : FORCE
  43.     @if [ ! -d dist ]; then $(MKDIR) dist ; fi
  44.  
  45. dist-tar : FORCE
  46.     cd bin/$(ARCH) ; \
  47.         tar cvvzf ../../dist/AROSbin-$(VERSION).tgz AROS
  48.     cd .. ; tar cvvzf AROS/dist/AROSdev-$(VERSION).tgz \
  49.         $(addprefix AROS/, $(SUBDIRS) $(DIST_FILES)) \
  50.         $(shell cd ..; find AROS/include -name "*.h")
  51.  
  52. dist-lha : FORCE
  53.     cd bin/$(ARCH) ; \
  54.         lha a ../../dist/AROSbin-$(VERSION).lha AROS
  55.     cd .. ; lha a AROS/dist/AROSdev-$(VERSION).lha \
  56.         $(addprefix AROS/, $(SUBDIRS) $(DIST_FILES)) \
  57.         $(shell cd ..; find AROS/include -name "*.h")
  58.  
  59. # Alwaye remake rules that depend on this one
  60. FORCE :
  61.  
  62. setup :
  63.     @if [ ! -d bin ]; then $(MKDIR) bin ; fi
  64.     @if [ ! -d bin/$(ARCH) ]; then $(MKDIR) bin/$(ARCH) ; fi
  65.     @if [ ! -d $(BINDIR) ]; then $(MKDIR) $(BINDIR) ; fi
  66.     @if [ ! -d $(SDIR) ]; then $(MKDIR) $(SDIR) ; fi
  67.     @if [ ! -d $(EXEDIR) ]; then $(MKDIR) $(EXEDIR) ; fi
  68.     @if [ ! -d $(LIBDIR) ]; then $(MKDIR) $(LIBDIR) ; fi
  69.     @if [ ! -d $(DEVSDIR) ]; then $(MKDIR) $(DEVSDIR) ; fi
  70.     @if [ ! -d $(SLIBDIR) ]; then $(MKDIR) $(SLIBDIR) ; fi
  71.     @if [ ! -d $(TESTDIR) ]; then $(MKDIR) $(TESTDIR) ; fi
  72.     @if [ ! -d $(GENDIR) ]; then $(MKDIR) $(GENDIR) ; fi
  73.     @if [ ! -d $(GENDIR)/test ]; then $(MKDIR) $(GENDIR)/test ; fi
  74.     @if [ ! -d $(GENDIR)/filesys ]; then $(MKDIR) $(GENDIR)/filesys ; fi
  75.  
  76. check : $(TESTS)
  77.     @for test in $(TESTS) ; do \
  78.         echo "Running test `basename $$test`" ; $$test ; \
  79.     done
  80.  
  81. clean:
  82.     $(RM) $(ARCHDIR) host.cfg
  83.     @for dir in $(SUBDIRS) ; do \
  84.         ( echo "Cleaning in $$dir..." ; cd $$dir ; \
  85.         $(MAKE) $(MFLAGS) clean ) ; \
  86.     done
  87.  
  88. $(BINDIR)/arosshell: $(GENDIR)/arosshell.o $(DEP_LIBS)
  89.     $(CC) $(CFLAGS) $< $(LIBS) $(X11LDFLAGS) -lX11 -o $@
  90.  
  91. subdirs:
  92.     @for dir in $(SUBDIRS) ; do \
  93.         echo "Making all in $$dir..." ; \
  94.         if ( cd $$dir ; \
  95.         $(MAKE) $(MFLAGS) CURDIR="$(CURDIR)/$$dir" all ) ; \
  96.         then echo -n ; else exit 1 ; fi \
  97.     done
  98.  
  99. # I have to restart make here since not all files might be existing
  100. # in $(OSGENDIR) at the time when make was started in the first place.
  101. AmigaOS :
  102.     $(MAKE) $(MFLAGS) $(LIBDIR)/libAmigaOS.a
  103.  
  104. $(LIBDIR)/libAmigaOS.a : $(wildcard $(OSGENDIR)/*.o) \
  105.         $(wildcard $(GENDIR)/alib/*.o)
  106.     $(AR) $@ $?
  107.     $(RANLIB) $@
  108.  
  109. $(SDIR)/Startup-Sequence : s/Startup-Sequence
  110.     $(CP) $^ $@
  111.  
  112. includes: include/clib/exec_protos.h \
  113.         include/clib/dos_protos.h \
  114.         include/clib/utility_protos.h \
  115.         include/clib/graphics_protos.h \
  116.         include/clib/intuition_protos.h \
  117.         include/clib/console_protos.h
  118.  
  119. include/clib/exec_protos.h: $(wildcard $(KERNEL)/*.s $(KERNEL)/*.c exec/*.c)
  120.     gawk -f scripts/genprotos.h --assign lib=Exec \
  121.     $(KERNEL)/*.s $(KERNEL)/*.c exec/*.c
  122.  
  123. include/clib/dos_protos.h: $(wildcard dos/*.c)
  124.     gawk -f scripts/genprotos.h --assign lib=Dos \
  125.     dos/*.c
  126.  
  127. include/clib/utility_protos.h: $(wildcard utility/*.c)
  128.     gawk -f scripts/genprotos.h --assign lib=Utility \
  129.     utility/*.c
  130.  
  131. include/clib/graphics_protos.h: $(wildcard graphics/*.c)
  132.     gawk -f scripts/genprotos.h --assign lib=Graphics \
  133.     graphics/*.c
  134.  
  135. include/clib/intuition_protos.h: $(wildcard intuition/*.c)
  136.     gawk -f scripts/genprotos.h --assign lib=Intuition \
  137.     intuition/*.c
  138.  
  139. include/clib/console_protos.h: devs/cdinputhandler.c devs/rawkeyconvert.c
  140.     gawk -f scripts/genprotos.h --assign lib=Console \
  141.     devs/cdinputhandler.c devs/rawkeyconvert.c
  142.  
  143. .FORCE:
  144.  
  145. $(GENDIR)/%.o: %.c
  146.     $(CC) $(CFLAGS) $< -c -o $@
  147.  
  148. #$(GENDIR)/%.d: %.c
  149. #     @$(RM) $@
  150. #     @touch $@
  151. #     @$(MKDEPEND) -f$@ -p$(GENDIR)/ -- $(CFLAGS) -- $^
  152. #
  153. #include $(GENDIR)/arosshell.d
  154.